package com.ttj.controller.service_group;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ttj.domain.oracle.BasService;
import com.ttj.domain.oracle.OrderInstock;
import com.ttj.domain.oracle.OrderRec;
import com.ttj.domain.oracle.SysconfService;
import com.ttj.domain.oracle.WebUser;
import com.ttj.service.serviceGroupService;
import com.ttj.vo.BaseRes;

/**
 * 服务组
 */
@Controller
@RequestMapping("serviceGroup")
public class ServiceGroupController {
	@Resource
	private serviceGroupService mserviceGroupService;
	@RequestMapping(value = "/showhome", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<SysconfService> showHome(String admin) {
		return mserviceGroupService.getUnResponseCount(admin);
	}
	/**
	 * 用于展示服务组未回复、已查看、已完成列表
	 */
	@RequestMapping(value = "/showserviceGroupList", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<Map> showServiceGroupList(String sid) {
		return mserviceGroupService.showServiceGroupList(sid);
	}
	/**
	 * 用于展示服务组未回复、已查看详情
	 */
	@RequestMapping(value = "/getByOrderId", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<BasService> getByOrderId(String orderId,String type) {
		return mserviceGroupService.getByOrderId(orderId,type);
	}
	
	/**
	 * 用于展示服务组已完成详情
	 */
	@RequestMapping(value = "/getCompleteByOrderId", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<BasService> getCompleteByOrderId(String orderId) {
		return mserviceGroupService.getCompleteByOrderId(orderId);
	}
	
	/**
	 * 用于服务组点击接受
	 */
	@RequestMapping(value = "/recieveMsg", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<BasService> recieveMsg(String orderId,String userName,String orderType) {
		return mserviceGroupService.recieveMsg(orderId,userName,orderType);
	}
	
	/**
	 * 用于服务组提货完成
	 */
	@RequestMapping(value = "/pickUpGoods", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<BasService> pickUpGoods(String orderId,String userName) {
		return mserviceGroupService.pickUpGoods(orderId,userName);
	}
	
	/**
	 * 用于服务组送货完成
	 */
	@RequestMapping(value = "/deliveryComplete", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<BasService> deliveryComplete(String orderId,String userName) {
		return mserviceGroupService.deliveryComplete(orderId,userName);
	}
	
	/**
	 * 用于服务组拉货管理列表
	 */
	@RequestMapping(value = "/showServicePullGoodsList", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<Map> showServicePullGoodsList(String sid) {
		return mserviceGroupService.showServicePullGoodsList(sid);
	}
	
	/**
	 * 用于服务组拉货管理详情页
	 */
	@RequestMapping(value = "/showServicePullGoodsDetail", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<OrderInstock> showServicePullGoodsDetail(String orderId,String type) {
		return mserviceGroupService.showServicePullGoodsDetail(orderId,type);
	}
	
	/**
	 * 用于服务组拉货管理合并拉货
	 */
	@RequestMapping(value = "/servicePullMerge", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<OrderInstock> servicePullMerge(String orderIds) {
		return mserviceGroupService.servicePullMerge(orderIds);
	}
	
	/**
	 * 用于展示服务组工作日志
	 */
	@RequestMapping(value = "/showServiceDailyLog", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<Map> showServiceDailyLog(String searchTimeType,String bUser,String startDate,String endDate) {
		return mserviceGroupService.showServiceDailyLog(searchTimeType,bUser,startDate, endDate);
	}
	
	
	/**
	 * 用于服务组查询条形码是否被绑定
	 */
	@RequestMapping(value = "/bandingBarcode", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<WebUser> bandingBarcode(String barcode,String cusername) {
		System.out.println(barcode);
		return mserviceGroupService.bandingBarcode(barcode,cusername);
	}
	
	/**
	 * 用于服务组查询条形码是否被绑定
	 */
	@RequestMapping(value = "/checkBarcode", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<WebUser> checkBarcode(String barcode) {
		System.out.println(barcode);
		return mserviceGroupService.checkBarcode(barcode);
	}
	
	/**
	 * 用于服务组获取回收物品列表
	 */
	@RequestMapping(value = "/getRecCategoryList", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<List> getRecCategoryList() {
		return mserviceGroupService.getRecCategoryList();
	}
	
	/**
	 * 用于服务组创建匿名回收
	 */
	@RequestMapping(value = "/createAnonymousOrderRec", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<OrderRec> createAnonymousOrderRec(String orderRecStr,String recCategoryDetailListStr) {
		return mserviceGroupService.createAnonymousOrderRec(orderRecStr,recCategoryDetailListStr);
	}
	
	/**
	 * 用于服务组创建企业回收
	 */
	@RequestMapping(value = "/createCompanyOrderRec", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<OrderRec> createCompanyOrderRec(String orderRecStr,String recCategoryDetailListStr) {
		return mserviceGroupService.createCompanyOrderRec(orderRecStr,recCategoryDetailListStr);
	}
	
	/**
	 * 用于后台创建的服务组回收订单完成回收
	 */
	@RequestMapping(value = "/checkCompanyBackstageOrderRec", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<OrderRec> checkCompanyBackstageOrderRec(String orderRecStr,String recCategoryDetailListStr) {
		return mserviceGroupService.checkCompanyBackstageOrderRec(orderRecStr,recCategoryDetailListStr);
	}
	
	/**
	 * 用于服务组企业回收查询客户信息
	 */
	@RequestMapping(value = "/getCustomerByBarcode", method = RequestMethod.GET)
	@ResponseBody
	public BaseRes<WebUser> getCustomerByBarcode(String barcode,String cname,String addr) {
		return mserviceGroupService.getCustomerByBarcode(barcode,cname,addr);
	}
}
